import request from "@/utils/request";
import axios from 'axios';

// 获取地表列表
export function getAllList(query) {
  return request({
    url: "/breakReport/breakPage",
    method: "get",
    params: query,
  });
}

// 生成地表报告
export function reportCreat(data, cancel) {
  return request({
    url: '/breakReport/createBreakReport',
    method: "post",
    data: data,
    cancelToken: new axios.CancelToken(function executor(c) {
      cancel.c = c;
    })
  });
}

// 获取报告信息 地表破裂带和滑坡
export function getReport(id,activeName) {
  console.log(id,'ididiidi');
  return request({
    url: activeName=='first'?'/breakReport/getReport': '/multiple/getReport',
    method: "get",
    params:{reportId:id}
  });
}

// 上传报告信息
export function uploadReport(data) {
  return request({
    url: '/report/uploadReport',
    method: "post",
    data: data,
  });
}

//提交审核 地表破裂带和滑坡
export function submitReview(id,activeName) {
  return request({
    url: activeName=='first'?'/breakReport/submitCheak': '/multiple/submitCheak',
    method: "post",
    data:{
    	reportId: id
    }
    
  });
}

// 取消生成
export function canceCreat(data, cancel) {
  return request({
    url: '/report/createReport',
    method: "post",
    data: data,
    // cancelToken: source.token
    //中止请求
    cancelToken: new axios.CancelToken(function executor(c) {
        cancel.cancel = c;
    })
  });
}

// 获取历史版本 地表破裂带和滑坡
export function getHisList(query) {
  return request({
    url: "/breakReport/getHistoryReport",
    method: "get",
    params: query,
  });
}

// 滑坡/砂土液化/软土震陷评估报告-获取列表
export function getList1Report(query) {
  return request({
    url: "/multiple/multiplePage",
    method: "get",
    params: query,
  })
}

// 滑坡/砂土液化/软土震陷评估报告-生成报告  
export function creatSamplingReport(data, cancel) {
  return request({
    url: '/multiple/createMultipleReport',
    method: "post",
    data: data,
    cancelToken: new axios.CancelToken(function executor(c) {
      cancel.c = c;
    })
  });
}

// 退回原因
export function getBackReportMsg(id,activeName) {
  return request({
    url: activeName=='first'?"/breakReport/getBackReportMsg":"/multiple/getBackReportMsg",
    method: "get",
    params:{reportId:id}
  });
}
